package tests;

import static org.junit.Assert.*;

import java.io.File;
import java.util.Date;
import org.junit.Before;
import org.junit.Test;
import papers.Manuscript;
import users.Author;
import users.Reviewer;

public class TestReviewer {

	private Reviewer john;
	private Author bob;
	private Manuscript paper;

	@Before
	public void setUp() {
		john = new Reviewer("John");
		bob = new Author("Bob");
		paper = new Manuscript(bob, new Date(), "On Cabbages and Kings",
				new File("nothing.txt"));
	}

	@Test
	public void testAddManuscript() {
		assertEquals("New reviewer has manuscripts", 0, john
				.getAssignedManuscripts().size());
		john.addAssignedManuscript(paper);
		assertEquals("Adding a manuscript did not result in more reviews", 1,
				john.getAssignedManuscripts().size());
	}
	
	@Test
	public void testAddNullManuscript() {
		john.addAssignedManuscript(null);
	}
	
	@Test
	public void testGetManuscript() {
		john.addAssignedManuscript(paper);
		assertTrue("Added manuscript not found", john.getAssignedManuscripts()
				.contains(paper));
	}

	@Test
	public void testGetRole() {
		assertEquals("The role is not the same", "Reviewer",
				john.getRole());
	}
}
